namespace Winner.Game.Entity.POCOModel
{
    using System;
    using System.Data.Entity;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Linq;

    public partial class GamePrintModel : DbContext
    {
        public GamePrintModel()
            : base("name=GamePrintModel")
        {
        }

        public virtual DbSet<Activity> Activity { get; set; }
        public virtual DbSet<AdminInfo> AdminInfo { get; set; }
        public virtual DbSet<AdminLevel> AdminLevel { get; set; }
        public virtual DbSet<AgentInfo> AgentInfo { get; set; }
        public virtual DbSet<GameInfo> GameInfo { get; set; }
        public virtual DbSet<GameList> GameList { get; set; }
        public virtual DbSet<GameType> GameType { get; set; }
        public virtual DbSet<OrderInfo> OrderInfo { get; set; }
        public virtual DbSet<UserInfo> UserInfo { get; set; }
        public virtual DbSet<UserLevel> UserLevel { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Activity>()
                .Property(e => e.ActivityName)
                .IsUnicode(false);

            modelBuilder.Entity<Activity>()
                .Property(e => e.ActivityInfo)
                .IsUnicode(false);

            modelBuilder.Entity<Activity>()
                .Property(e => e.ActivityPeople)
                .IsUnicode(false);

            modelBuilder.Entity<Activity>()
                .Property(e => e.ActivityAddress)
                .IsUnicode(false);

            modelBuilder.Entity<AdminInfo>()
                .Property(e => e.AdminName)
                .IsUnicode(false);

            modelBuilder.Entity<AdminInfo>()
                .Property(e => e.AdminPassword)
                .IsUnicode(false);

            modelBuilder.Entity<AdminLevel>()
                .Property(e => e.levelName)
                .IsUnicode(false);

            modelBuilder.Entity<AdminLevel>()
                .HasMany(e => e.AdminInfo)
                .WithRequired(e => e.AdminLevel)
                .HasForeignKey(e => e.AdminType)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<AgentInfo>()
                .Property(e => e.AgentName)
                .IsUnicode(false);

            modelBuilder.Entity<AgentInfo>()
                .Property(e => e.AgentGameName)
                .IsUnicode(false);

            modelBuilder.Entity<AgentInfo>()
                .Property(e => e.AgentNews)
                .IsUnicode(false);

            modelBuilder.Entity<AgentInfo>()
                .HasMany(e => e.GameInfo)
                .WithRequired(e => e.AgentInfo)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<GameInfo>()
                .Property(e => e.GameName)
                .IsUnicode(false);

            modelBuilder.Entity<GameInfo>()
                .Property(e => e.GameRemark)
                .IsUnicode(false);

            modelBuilder.Entity<GameInfo>()
                .HasMany(e => e.GameList)
                .WithRequired(e => e.GameInfo)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<GameInfo>()
                .HasMany(e => e.OrderInfo)
                .WithRequired(e => e.GameInfo)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<GameType>()
                .Property(e => e.TypeName)
                .IsUnicode(false);

            modelBuilder.Entity<GameType>()
                .HasMany(e => e.GameInfo)
                .WithRequired(e => e.GameType)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<UserInfo>()
                .Property(e => e.UserName)
                .IsUnicode(false);

            modelBuilder.Entity<UserInfo>()
                .Property(e => e.LoginName)
                .IsUnicode(false);

            modelBuilder.Entity<UserInfo>()
                .Property(e => e.UserPassword)
                .IsUnicode(false);

            modelBuilder.Entity<UserInfo>()
                .Property(e => e.UserEmail)
                .IsUnicode(false);

            modelBuilder.Entity<UserInfo>()
                .HasMany(e => e.OrderInfo)
                .WithRequired(e => e.UserInfo)
                .HasForeignKey(e => e.UserName)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<UserLevel>()
                .Property(e => e.LevelName)
                .IsUnicode(false);

            modelBuilder.Entity<UserLevel>()
                .HasMany(e => e.UserInfo)
                .WithRequired(e => e.UserLevel1)
                .HasForeignKey(e => e.UserLevel)
                .WillCascadeOnDelete(false);
        }
    }
}
